import { View, Image } from '@tarojs/components';
import { useState, useEffect } from 'react';
import Taro from '@tarojs/taro';
import cartIcon from '@/assets/images/components/cart.png';
import './index.scss';

export default function () {
  const [count, setCount] = useState(0);
  useEffect(() => {
    setCount(1);
  }, []);

  const toCartPage = () => {
    Taro.navigateTo({
      url: '/subPages/cart/index',
    });
  };

  return (
    <View className="cart-btn" onClick={toCartPage}>
      <Image src={cartIcon} />
      <View className="badge">{count}</View>
    </View>
  );
}
